package business.command
{
	import business.event.GetProductByProductIdEvent;
	import business.service.delegate.BusinessAMDelegate;
	
	import com.adobe.cairngorm.commands.ICommand;
	import com.adobe.cairngorm.control.CairngormEvent;
	
	import mx.controls.Alert;
	import mx.rpc.IResponder;
	import business.modelLocators.ProductModelLocator;
	import valueObjects.Product;
	
	public class GetProductByProductIdCommand implements ICommand, IResponder
	{
		public function GetProductByProductIdCommand()
		{
		}
		public function execute(event:CairngormEvent):void {
			var productId:String = (event as GetProductByProductIdEvent).productId;
			var businessAMDelegate:BusinessAMDelegate = new BusinessAMDelegate(this);
			businessAMDelegate.getProductByProductId(productId);
		}
		public function result(result:Object):void {
			ProductModelLocator.getInstance().currentProduct = result.result as Product;
		}
		public function fault(info:Object):void {
			Alert.show("GetProductByProductIdCommand fault");
		}
		

	}
}